﻿<?php defined('_JEXEC') or die('Restricted access'); ?>

<?php 
/*
Käytetään default.phpssa includena
<?php echo $this->loadTemplate('position'); ?>

print_r($this->position);

*/

?>

<?php
/*
$doc =& JFactory::getDocument();

$doc->addScript("https://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js");
$doc->addScript("http://www.maunula.net/components/com_dpcal/js/jqModal.js");
$doc->addScript("http://www.maunula.net/components/com_dpcal/js/jquery.dimensions.min.js");
$doc->addScript("http://www.maunula.net/components/com_dpcal/js/jquery.bgiframe.pack.js");
$doc->addScript("http://www.maunula.net/components/com_dpcal/js/dpcal_events.js");
$doc->addScript("components/com_dpposition/js/OpenLayers.js");
$doc->addScript("components/com_dpposition/js/OpenLayers.Click.js");
$doc->addScript("components/com_palvelutiski/mootools-1.2.1-core-yc.js");
$doc->addScript("http://maps.google.com/maps?file=api&amp;v=2&amp;key=ABQIAAAAOrUf2_r_Bu3eBENNngdR2RRz6SIhhAwZ4nnqpMHGUyMk7yG7yhQMfuetMDJVXaIwDyuLXGL89SBHpw&hl=fi");
$doc->addScript("components/com_dpposition/js/OLDPPositionStyle.js");
$doc->addScript("components/com_dpposition/js/OLDPPositionMap.js");
$doc->addScript("components/com_dpposition/js/OLDPPositionMap.Google.js");
$doc->addScript("components/com_mapedit/mapedit.js");
$doc->addStylesheet("components/com_mapedit/mapedit.css");
$doc->addStylesheet("components/com_dpposition/css/reset.css");

$doc->addStylesheet("components/com_dpposition/css/overlay.css");
$doc->addStylesheet("components/com_dpposition/css/form.event.css");
$doc->addScript("components/com_dpposition/js/OLDPPositionMap.HEL.js");
$doc->addScript("components/com_dpposition/js/DPOverlay.js");
$doc->addScript("components/com_dpposition/js/OLDPPositions.js");
$doc->addScript("components/com_dpposition/js/OLDPPositionEvent.js");
$doc->addScript("components/com_dpposition/js/OLDPPosition.js");
$doc->addScript("components/com_dpposition/js/OLDPPositionEvent.js");
$doc->addScript("components/com_dpposition/js/OLDPPositionEvent.js");
$doc->addScript("components/com_dpposition/js/OLDPPredefined.js");
*/
?>




<!--Map js -->
<!--<script  charset="utf-8" type="text/javascript" src="http://www.maunula.net/components/com_dpcal/js/jquery-1.2.3.js"></script>-->
<?php /*
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js"></script>

<script  charset="utf-8" type="text/javascript" src="http://www.maunula.net/components/com_dpcal/js/jqModal.js"></script>
<script  charset="utf-8" type="text/javascript" src="http://www.maunula.net/components/com_dpcal/js/jquery.dimensions.min.js"></script>
<script  charset="utf-8" type="text/javascript" src="http://www.maunula.net/components/com_dpcal/js/jquery.bgiframe.pack.js"></script>
<script type="text/javascript" src="http://www.maunula.net/components/com_dpcal/js/jquery.clockpick.1.2.4.js"></script>
*/
?>
<!--
<script  charset="utf-8" type="text/javascript" src="http://www.maunula.net/components/com_dpcal/js/dpcal_events.js"></script>
-->
<!--
<script src="components/com_dpposition/js/OpenLayers.js" type="text/javascript"></script>
<script src="components/com_palvelutiski/mootools-1.2.1-core-yc.js" type="text/javascript"></script>
<script src="http://maps.google.com/maps?file=api&amp;v=2&amp;key=ABQIAAAAOrUf2_r_Bu3eBENNngdR2RRz6SIhhAwZ4nnqpMHGUyMk7yG7yhQMfuetMDJVXaIwDyuLXGL89SBHpw&hl=fi" type="text/javascript"></script>
-->
<?php // localhost api key ?>
<script src="http://maps.google.com/maps?file=api&amp;v=2&amp;key=ABQIAAAAqHdXOqn72ACNI-NCmclTYxT2yXp_ZAY8_ufC3CFXhHIE1NvwkxRbm_KOuIbbh2cLGlyHi7EN8zbGeQ&hl=fi" type="text/javascript"></script>
<!--
<script src="components/com_dpposition/js/OpenLayers.Click.js" type="text/javascript"></script>
-->

<script src="components/com_dpposition/js/OLDPPositionStyle.js" type="text/javascript"></script>
<script src="components/com_dpposition/js/OLDPPositionMap.js" type="text/javascript"></script>
<script src="components/com_dpposition/js/OLDPPositionMap.Google.js" type="text/javascript"></script>

<script src="components/com_mapedit/mapedit.js" type="text/javascript"></script>
<link href="components/com_mapedit/mapedit.css" rel="stylesheet" type="text/css" />
<link href="components/com_dpposition/css/reset.css" rel="stylesheet" type="text/css" />

<!--<script src="http://www.maunula.net/components/com_dpposition/js/jq.js" language="JavaScript" type="text/javascript"></script>-->
<script src="components/com_dpposition/js/OpenLayers.js" language="JavaScript" type="text/javascript"></script>
<script src="components/com_dpposition/js/OpenLayers.Click.js" language="JavaScript" type="text/javascript"></script>
<script src="com_dpposition/js/OLDPPositionStyle.js" language="JavaScript" type="text/javascript"></script>


<script src="components/com_dpposition/js/OLDPPositionMap.js" language="JavaScript" type="text/javascript"></script>
<script src="components/com_dpposition/js/OLDPPositionMap.Google.js" type="text/javascript"></script>
<!--<script src="components/com_dpposition/js/OLDPPositionMap.HEL.js" language="JavaScript" type="text/javascript"></script>-->
<link href="components/com_dpposition/css/overlay.css" rel="stylesheet" type="text/css" />
<link href="components/com_dpposition/css/form.event.css" rel="stylesheet" type="text/css" />
<script src="components/com_dpposition/js/DPOverlay.js" language="JavaScript" type="text/javascript"></script>
<script src="components/com_dpposition/js/OLDPPositions.js" language="JavaScript" type="text/javascript"></script>
<script src="components/com_dpposition/js/OLDPPositionsEvent.js" language="JavaScript" type="text/javascript"></script>
<script src="components/com_dpposition/js/OLDPPosition.js" language="JavaScript" type="text/javascript"></script>
<script src="components/com_dpposition/js/OLDPPositionEvent.js" language="JavaScript" type="text/javascript"></script>
<script src="components/com_dpposition/js/OLDPPredefined.js" language="JavaScript" type="text/javascript"></script>


<!--
<script type="text/javascript">jQuery(function (){
			var p = new OLDPPositionsEvent({
				formID:     "dpposition_form",
				divID:      "dppositions",
				iconUrl:    "http://www.maunula.net/components/com_dpposition/images/needle.png",
				iconWidth:  20,
				iconHeight: 34,
				eventID:    0,
				type:       0,
				dfltStatus: 1,
				dfltLon:    24.930053456,
				dfltLat:    60.231605528,
				dfltZoom:   1,
				dfltPID:    1
			});
p.addDefaultPosition();});</script>
-->
<?php
/*
*/
?>

<!--
Sijainti <span class='help'>(Sijoita tapahtuma kartalle napista aukeavalla paikkavalitsimella)</span>	
-->


<div id="mapedit" style="margin: 0 0 10px 10px">
		<div id="service_map" class="map" style="display: none; height: 200px; width: 200px"></div>
		<span id="position_name">Paikan nimi</span><br /><span id="position_address">Paikan osoite</span>
   		<input type="hidden" name="dpposition_id2" value="" />
<!--   		<input type="hidden" name="dpposition_name" value="" /> -->
</div>

		<script type="text/javascript">
		window.addEvent('domready', function() {
			
			$('service_map').setStyle('display', 'block');
			var m = new OLDPPositionMap({
				divID:      "service_map",
				iconUrl:    "components/com_dpposition/images/needle.png",
				iconWidth:  20,
				iconHeight: 34
			});
			
			var mapData = {
				'buttonHolder': $('mapedit'),
				'position_id': <?php echo $this->position[0]->dpposition_id ?>,
				'position_name': "<?php echo $this->position[0]->dpposition_name ?>",
				'position_address': "<?php echo $this->position[0]->dpposition_street ?>",
				'position_zoom': <?php echo $this->position[0]->dpposition_zoom ?>,
				'position_lon': <?php echo $this->position[0]->dpposition_lon ?>,
				'position_lat': <?php echo $this->position[0]->dpposition_lat ?>,
				'update': function() {
					if (this.position_lon && this.position_lat && this.position_zoom) {
						$('service_map').setStyle('display', 'block');
						m.removeLastPosition();
						m.addPosition(this.position_lon, this.position_lat, this.position_zoom);
						m.centerMap();
						
					} else {
						$('service_map').setStyle('display', 'none');
						
					}
					$('position_name').set('text',this.position_name);
					$('position_address').set('text',this.position_address);
//					$(document.forms.service.dpposition_name).set('value', this.position_name);
					//$(document.forms.ehdota.dpposition_id2).set('value', this.position_id);
				}
				
			}
			
			mapedit_init(mapData);
			mapData.update();
		});
	</script>
	
	

